import {createRouter, createWebHistory, createWebHashHistory} from 'vue-router'
import {defaultRouter} from './modules/default'
import {setDocumentTitle} from '@/utils'
import {showToast} from 'vant'
import auth from "@/utils/auth";

const routes = [...defaultRouter]

const router = createRouter({
    // history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH),
    history: createWebHashHistory(),
    routes,
    strict: true,
    scrollBehavior: () => ({left: 0, top: 0})
})

router.beforeEach(async (to, from, next) => {
    setDocumentTitle(to.meta.title as string)
    next()
})

export default router
